import Vue from 'vue'
/**
 * 工具函数封装
 */

//接口
import axios from 'axios'
//设置请求的基本路径
axios.defaults.baseURL = 'http://127.0.0.1:5000'

//创建一个通信线程
export const bus = new Vue()


//获取中国时间
export const getChinaTime = utctime => {
    let d = new Date(utctime)
    return d.getFullYear() + "-" + getFullNum(d.getMonth() + 1) + "-" + getFullNum(d.getDate()) + " " + getFullNum(d.getHours()) + ":" + getFullNum(d.getMinutes()) + ":" + getFullNum(d.getSeconds())
}

//补0
export const getFullNum = num => num < 10 ? "0" + num : num


//暴露接口
export default axios
